<template>
  <div>
    <bgHeader title="房屋管理" />
    <div class="main">
      <gghouseList v-if="rentList.length" :getHouseList="rentList" />
      <van-empty v-else>
        <template #description>
          <span
            >您还没有房源，<span @click="$router.push('/add')" class="color"
              >去发布房源</span
            >吧~</span
          >
        </template>
      </van-empty>
    </div>
  </div>
</template>

<script>
import bgHeader from '@/components/gbhearder'
import gghouseList from '@/components/gghouseList'
import { getRentApi } from '@/api'
export default {
  name: 'rent',
  components: {
    bgHeader,
    gghouseList
  },
  props: {},
  data() {
    return {
      rentList: []
    }
  },
  computed: {},
  watch: {},
  created() {
    this.getFavorateList()
  },
  methods: {
    async getFavorateList() {
      this.$toast.loading({
        message: '加载中...',
        forbidClick: true,
        duration: 0
      })
      const { data: res } = await getRentApi()
      this.rentList = res.body
      this.$toast.clear()
    }
  }
}
</script>

<style scoped lang="less">
.main {
  padding: 92px 0 0 0;
}
.color {
  color: #33be85;
}
</style>
